<?php 
$this->headTitle('Chi Tiết Tin', 'append');
?>
<style>th{width:100px;}</style>
<div class="dashboard-menu dashboard-admin">
    <span class="back">&nbsp;</span>
    <h1>Loại Tin: <?php echo ($this->adsFor['transaction']==1)? 'Cho Thuê':'Cần Bán';  ?></h1>
</div>
<div>
    <table class="table table-condensed">
        <tr>
            <th>Tiêu Đề</th>
            <td><?php echo $this->adsFor['title'];?></td>
            <th>Ngày Đăng Tin</th>
            <td><?php echo date("Y-m-d", $this->adsFor['createDate']);?></td>
        </tr>
        <tr class="info">
            <th>Ngày Bắt Đầu</th>
            <td><?php echo date("Y-m-d", $this->adsFor['startDate']);?></td>
            <th>Ngày Kết Thúc</th>
            <td><?php echo date("Y-m-d", $this->adsFor['endDate']);?></td>
        </tr>
        <tr >
            <th>Nội Dung</th>
            <td colspan="4">
                <span><?php echo $this->adsFor['content']?></span>
            </td>
        </tr>
        <tr class="warning">
            <th>Loại Bất Động Sản</th>
            <td><?php echo $this->adsFor['estateName'];?></td>
            <th>Dự Án</th>
            <td><?php
                if(isset($this->adsFor['projectName']) && $this->adsFor['projectName']){
                    echo "{$this->adsFor['projectName']}";
                }else{
                    echo '<span class="active glyphicon glyphicon-minus" title="Null"></span>';
                }
            ?></td>
        </tr>
        <tr>
            <th>Diện Tích</th>
            <td><?php echo $this->adsFor['area'];?> m2</td>
            <th>Giá</th>
            <td><?php echo $this->adsFor['price'];?></td>
        </tr>
        <tr class="success">
            <th>Đơn Vị Tính</th>
            <td><?php $loai=$this->adsFor['transaction'];$ma=$this->adsFor['unit'];echo $this->configUnit->item->unit->$loai->$ma;?></td>
            <th>Tổng Tiền</th>
            <td><?php echo $this->adsFor['total'];?></td>
        </tr>
        <tr>
            <th>Địa Chỉ</th>
            <td><?php echo $this->adsFor['address'];?></td>
            <th>Người Liên Hệ</th>
            <td><?php echo $this->adsFor['contact'];?></td>
        </tr>
        <tr class="danger">
            <th>Mobile</th>
            <td><?php echo $this->adsFor['mobile'];?></td>
            <th>Phone</th>
            <td><?php
                if(isset($this->adsFor['phone']) && $this->adsFor['phone']){
                    echo "{$this->adsFor['phone']}";
                }else{
                    echo '<span class="active glyphicon glyphicon-minus" title="Null"></span>';
                }
            ?></td>
        </tr>
        <tr>
            <th>Email</th>
            <td><?php echo $this->adsFor['email'];?></td>
            <th>Tình Trạng</th>
            <td><?php
                if($this->adsFor['status'] == 1){
                    echo '<span class="active glyphicon glyphicon-ok" title="Enable"></span>';
                }else{
                    echo '<span class="active glyphicon glyphicon-minus" title="Disable"></span>';
                }
            ?></td>
        </tr>
        <?php
            $count=count($this->other);
            $count1=$count;
            foreach($this->other as $key=>$val){
                if($count1%2==0){
                    if($count%2==0){?>
                        <tr class="warning">
                            <th><?php echo $key;?></th>
                            <td><?php echo $val;?></td>
                    <?php }else{?>
                            <th><?php echo $key;?></th>
                            <td><?php echo $val;?></td>
                        </tr>
                    <?php }
                    $count--; 
                }else{
                    if($count==1){?>
                        <tr class="warning">
                            <th><?php echo $key;?></th>
                            <td><?php echo $val;?></td>
                            <th></th>
                            <td></td>
                        </tr>
                    <?php continue;}
                    if($count%2!=0){
                    ?>
                        <tr class="warning">
                            <th><?php echo $key;?></th>
                            <td><?php echo $val;?></td>
                    <?php }else{?>
                            <th><?php echo $key;?></th>
                            <td><?php echo $val;?></td>
                        </tr>
                    <?php }
                    $count--; 
                }
            }
        ?>
    </table>
</div>

